$.ajaxPrefilter(function (options) {
  options.url = "http://big-event-api-t.itheima.net" + options.url;
  //只要链接里面有my  那么就不能进入主页
  if (options.url.indexOf("/my/") != -1) {
    //返回权限
    options.headers = { Authorization: localStorage.getItem("token") };
    options.complete = function (res) {
      // console.log(res);
      //如果验证身份失败
      if (
        res.responseJSON.status == 1 &&
        res.responseJSON.message == "身份认证失败！"
      ) {
        localStorage.removeItem("token");
        location.href = "/login.html";
      }
    };
  }
});
